﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace BulldogCMS.Data.Tests.Common
{
    public class TestingDatabaseDefinitionProvider : BulldogCMS.Data.IDatabaseDefinitionProvider
    {
        private XDocument templatesXDoc = XDocument.Load(TestingData.ReflectionHelper.GetResourceStream("BulldogCMS.Data.Tests.TestingData.VolksbankWeb.xml"));

        public Data.Templates.ITemplatesProvider GetTemplatesProvider()
        {
            return new BulldogCMS.Data.Templates.XMLTemplatesProvider(this.templatesXDoc);
        }

        public ContentTree.IContentTreeProvider GetContentTreeProvider()
        {
            return new BulldogCMS.Data.ContentTree.XMLContentTreeProvider(this.templatesXDoc);
        }

        public FilesTree.IFilesTreeProvider GetFilesTreeProvider()
        {
            return new BulldogCMS.Data.FilesTree.XMLFilesTreeProvider(this.templatesXDoc);
        }

        public static BulldogCMS.Data.IDatabaseDefinitionProvider CreateProvider()
        {
            return new TestingDatabaseDefinitionProvider();
        }

        public Security.ISecurityTreeProvider GetSecurityTreeProvider()
        {
            return new Security.XMLSecurityTreeProvider(this.templatesXDoc);
        }
    }
}
